package com.frank.reader.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;

@Controller
public class TestController {
    @RequestMapping("/test/t1")
    public ModelAndView test1() {

        ModelAndView mav = new ModelAndView("test");
        mav.addObject("username", "胡伟峰");
        return mav;
    }

    @RequestMapping("/test/t2")
    @ResponseBody
    public Map test2() {
        Map<String, String> map = new HashMap<>();
        map.put("username", "Frank");
        return map;
    }

}
